<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>接口自动化测试报告</title>
    <meta name="generator" content="HTMLTestRunner 1.2.0"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
    <script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>
    
<style type="text/css" media="screen">
body        { font-family: Microsoft YaHei;padding: 20px; font-size: 100%; }
table       { font-size: 100%; }
.table tbody tr td{
            vertical-align: middle;
        }

/* -- heading ---------------------------------------------------------------------- */
.heading .description, .attribute {
    clear: both;
}

/* --- 失败和错误合集样式 -- Gelomen --- */
.failCollection, .errorCollection {
    width: 100px;
    float: left;
}
#failCaseOl li {
    color: red
}
#errorCaseOl li {
    color: orange
}

/* --- 打开截图特效样式 -- Gelomen --- */
.data-img{
    cursor:pointer
}

.pic_looper{
    width:100%;
    height:100%;
    position: fixed;
    left: 0;
    top:0;
    opacity: 0.6;
    background: #000;
    display: none;
    z-index: 100;
}

.pic_show{
    width:100%;
    position:fixed;
    left:0;
    top:0;
    right:0;
    bottom:0;
    margin:auto;
    text-align: center;
    display: none;
    z-index: 100;
}

.pic_box{
    padding:10px;
    width:90%;
    height:90%;
    margin:40px auto;
    text-align: center;
    overflow: hidden;
}

.pic_box img{
    width: auto;
    height: 100%;
    -moz-box-shadow: 0px 0px 20px 0px #000;
    -webkit-box-shadow: 0px 0px 20px 0px #000;
    box-shadow: 0px 0px 20px 0px #000;
}

/* --- 饼状图div样式 -- Gelomen --- */
#container {
    width: 450px;
    height: 300px;
    float: left;
}

/* -- report ------------------------------------------------------------------------ */
#total_row  { font-weight: bold; }
.passCase   { color: #5cb85c; }
.failCase   { color: #d9534f; font-weight: bold; }
.errorCase  { color: #f0ad4e; font-weight: bold; }
.hiddenRow  { display: none; }
.testcase   { margin-left: 2em; }
.screenshot:link { text-decoration: none;color: deeppink; }
.screenshot:visited { text-decoration: none;color: deeppink; }
.screenshot:hover { text-decoration: none;color: darkcyan; }
.screenshot:active { text-decoration: none;color: deeppink; }
</style>

</head>
<body >
<script language="javascript" type="text/javascript">

    $(function(){
        // 修改 失败 和 错误 用例里对应按钮的颜色ClassName为动态加载 -- Gelomen
    	$("button").each(function () {
    	    var text = $(this).text();
    	    if(text == "失败"){
    	        $(this).addClass("btn-danger")
            }else if(text == "错误") {
                $(this).addClass("btn-warning")
            }
        });

        // 给失败和错误合集加样式 -- Gelomen
        var p_attribute = $("p.attribute");
        p_attribute.eq(4).addClass("failCollection");
        p_attribute.eq(5).addClass("errorCollection");

        // 打开截图，放大，点击任何位置可以关闭图片  -- Gelomen
        $(".screenshot").click(function(){
            var img = $(this).attr("img");
            $('.pic_show img').attr('src', img);
            $('.pic_looper').fadeIn(200);
            $('.pic_show').fadeIn(200);

            var browserHeight = $(window).height();
            var pic_boxHeight = $(".pic_box").height();
            var top = (browserHeight - pic_boxHeight)/2;
            $('.pic_box').css("margin-top", top + "px")

        });
        $('.pic_looper, .pic_show').click(function(){
            $('.pic_looper').fadeOut(200);
            $('.pic_show').fadeOut(200)
        });
        
        var browserWidth = $(window).width();
        var margin_left = browserWidth/2 - 450;
        if(margin_left <= 240){
            $("#container").css("margin", "auto");
        }else {
            $("#container").css("margin-left", margin_left + "px");
        }

        $(window).resize(function(){
            // 改变窗口大小时，自动改变图片与顶部的距离  -- Gelomen
            var browserHeight = $(window).height();
            var pic_boxHeight = $(".pic_box").height();
            var top = (browserHeight - pic_boxHeight)/2;
            $('.pic_box').css("margin-top", top + "px");


            // 改变窗口大小时，自动改变饼图的边距  -- Gelomen
            var browserWidth = $(window).width();
            var margin_left = browserWidth/2 - 450;
            if(margin_left <= 240){
                $("#container").css("margin", "auto");
            }else {
                $("#container").css("margin-left", margin_left + "px");
            }
        });

        // 距离顶部超过浏览器窗口一屏时，回到顶部按钮才出现  -- Gelomen
        $(window).scroll(function(){
            var browserHeight = $(window).height();
            var top = $(window).scrollTop();
            if(top >= browserHeight){
                $("#toTop").css("display", "block")
            }else {
                $("#toTop").css("display", "none")
            }
        })
        
        // 增加回到顶部过程的动画，以看上去不会那么生硬  -- Gelomen
        $("#toTop").click(function() {
            $("html,body").animate({"scrollTop":0}, 700)
        })
        
        // 增加饼状图  -- Gelomen
        $('#container').highcharts({
            chart: {
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false,
                spacing : [0, 0, 0, 0]
            },
            credits: {
                enabled: false
            },
            navigation: {
                buttonOptions: {
                    enabled: false
                }
            },
            title: {
                floating:true,
                text: '测试结果占比'
            },
            tooltip: {
                pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    colors: ['#81ca9d', '#f16d7e', '#fdc68c'],
                    dataLabels: {
                        enabled: true,
                        format: '<b>{point.name}</b>: {point.percentage:.1f} %',
                        style: {
                            color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                        }
                    },
                    point: {
                        events: {
                            mouseOver: function(e) {  // 鼠标滑过时动态更新标题
                                chart.setTitle({
                                    text: e.target.name+ '\t'+ e.target.y + ' 个'
                                });
                            }
                        }
                    }
                }
            },
            series: [{
                type: 'pie',
                innerSize: '80%',
                name: '比例',
                data: [
                    ['通过', 1],
                    {
                        name: '失败',
                        y: 2,
                        sliced: true,
                        selected: true
                    },
                    ['错误', 0]
                ]
            }]
        }, function(c) {
            // 环形图圆心
            var centerY = c.series[0].center[1],
                titleHeight = parseInt(c.title.styles.fontSize);
            c.setTitle({
                y:centerY + titleHeight/2
            });
            chart = c;
        });
        
        // 查看 失败 和 错误 合集链接文字切换  -- Gelomen
        $(".showDetail").click(function () {
            if($(this).html() == "点击查看"){
                $(this).html("点击收起")
            }else {
                $(this).html("点击查看")
            }
        })
    });
    
    
output_list = Array();

/*level 调整增加只显示通过用例的分类 --Findyou / 修复筛选显示bug --Gelomen
0:Summary //all hiddenRow
1:Failed  //pt&et hiddenRow, ft none
2:Pass    //pt none, ft&et hiddenRow
3:Error   //pt&ft hiddenRow, et none
4:All     //all none
*/
function showCase(level) {
    trs = document.getElementsByTagName("tr");
    for (var i = 0; i < trs.length; i++) {
        tr = trs[i];
        id = tr.id;
        if (id.substr(0,2) == 'ft') {
            if (level == 2 || level == 0 || level == 3) {
                tr.className = 'hiddenRow';
            }
            else {
                tr.className = '';
                // 切换筛选时只显示预览   -- Gelomen
                $("div[id^='div_ft']").attr("class", "collapse");
                $("div[id^='div_et']").attr("class", "collapse");
            }
        }
        if (id.substr(0,2) == 'pt') {
            if (level == 1 || level == 0 || level == 3) {
                tr.className = 'hiddenRow';
            }
            else {
                tr.className = '';
                // 切换筛选时只显示预览   -- Gelomen
                $("div[id^='div_ft']").attr("class", "collapse");
                $("div[id^='div_et']").attr("class", "collapse");
            }
        }
        if (id.substr(0,2) == 'et') {
            if (level == 1 || level == 0 || level == 2) {
                tr.className = 'hiddenRow';
            }
            else {
                tr.className = '';
                // 切换筛选时只显示预览   -- Gelomen
                $("div[id^='div_ft']").attr("class", "collapse");
                $("div[id^='div_et']").attr("class", "collapse");
            }
        }
    }

    //加入【详细】切换文字变化 --Findyou
    detail_class=document.getElementsByClassName('detail');
	//console.log(detail_class.length)
	if (level == 3) {
		for (var i = 0; i < detail_class.length; i++){
			detail_class[i].innerHTML="收起"
		}
	}
	else{
			for (var i = 0; i < detail_class.length; i++){
			detail_class[i].innerHTML="详细"
		}
	}
}

function showClassDetail(cid, count) {
    var id_list = Array(count);
    var toHide = 1;
    for (var i = 0; i < count; i++) {
        //ID修改 点 为 下划线 -Findyou
        tid0 = 't' + cid.substr(1) + '_' + (i+1);
        tid = 'f' + tid0;
        tr = document.getElementById(tid);
        if (!tr) {
            tid = 'p' + tid0;
            tr = document.getElementById(tid);
            if (!tr) {
                tid = 'e' + tid0;
                tr = document.getElementById(tid);
            }
        }
        id_list[i] = tid;
        if (tr.className) {
            toHide = 0;
        }
    }
    for (var i = 0; i < count; i++) {
        tid = id_list[i];
        //修改点击无法收起的BUG，加入【详细】切换文字变化 --Findyou
        if (toHide) {
            document.getElementById(tid).className = 'hiddenRow';
            document.getElementById(cid).innerText = "详细"
        }
        else {
            document.getElementById(tid).className = '';
            document.getElementById(cid).innerText = "收起"
        }
    }
}

function html_escape(s) {
    s = s.replace(/&/g,'&amp;');
    s = s.replace(/</g,'&lt;');
    s = s.replace(/>/g,'&gt;');
    return s;
}
</script>
<div class='pic_looper'></div> <div class='pic_show'><div class='pic_box'><img src=''/></div> </div>
<div class='heading'>
<div style="width: 650px; float: left;">
    <h1 style="font-family: Microsoft YaHei">接口自动化测试报告</h1>
    <p class='attribute'><strong>测试人员 : </strong> P17P18</p>
<p class='attribute'><strong>开始时间 : </strong> 2022-11-27 11:36:55</p>
<p class='attribute'><strong>合计耗时 : </strong> 0:00:01.488612</p>
<p class='attribute'><strong>测试结果 : </strong> 共 3，通过 1，失败 2，通过率 = 33.33%</p>
<p class='attribute'><strong>失败用例合集 : </strong> <div class='panel-default' style='float: left;'><a class='showDetail' data-toggle='collapse' href='#failCaseOl' style='text-decoration: none;'>点击查看</a></div><ol id='failCaseOl' class='collapse' style='float: left;'><li>test_api_case[1](((), {'case_id': 'api_case_2', 'case_step': [{'测试用例编号': 'api_case_2', '测试用例名称': '创建标签接口测试', '用例执行': '是', '用例步骤': 'step_01', '接口名称': '获取access_token接口', '请求方式': 'get', '请求头部信息': '', '请求地址': '/cgi-bin/token', '请求参数(get)': '{"grant_type":"client_credential","appid":"wx55614004f367f8ca","secret":"65515b46dd758dfdb09420bb7db2c67f"}', '请求参数(post)': '', '取值方式': '正则取值', '取值变量': 'token', '取值代码': '"access_token":"(.+?)"', '断言类型': 'json_key', '期望结果': 'access_token'}, {'测试用例编号': 'api_case_2', '测试用例名称': '创建标签接口测试', '用例执行': '是', '用例步骤': 'step_02', '接口名称': '创建标签接口', '请求方式': 'post', '请求头部信息': '', '请求地址': '/cgi-bin/tags/create', '请求参数(get)': '{"access_token":"63_wg5W7gleQfRjqxLsu6GWfPerPsOZwrPw7GmNkh0cl88to61ts9rh3WUFve-muB4Mh8ywmkYgG_4Q9MdKoLAd0GW5Z98xnvwFGLOIbIiRRjjY-IRg9-2W3BxS0VMLRLhADACIC"}', '请求参数(post)': '{"tag":{"name":"邵阳12"}}', '取值方式': '无', '取值变量': '', '取值代码': '', '断言类型': 'json_key', '期望结果': 'tag'}]})) (paramunittest.TestApiCase_1)</li><li>test_api_case[2](((), {'case_id': 'api_case_3', 'case_step': [{'测试用例编号': 'api_case_3', '测试用例名称': '删除标签接口测试', '用例执行': '是', '用例步骤': 'step_01', '接口名称': '获取access_token接口', '请求方式': 'get', '请求头部信息': '', '请求地址': '/cgi-bin/token', '请求参数(get)': '{"grant_type":"client_credential","appid":"wx55614004f367f8ca","secret":"65515b46dd758dfdb09420bb7db2c67f"}', '请求参数(post)': '', '取值方式': 'jsonpath取值', '取值变量': 'token', '取值代码': '$.access_token', '断言类型': 'json_key', '期望结果': 'access_token'}, {'测试用例编号': 'api_case_3', '测试用例名称': '删除标签接口测试', '用例执行': '是', '用例步骤': 'step_02', '接口名称': '创建标签接口', '请求方式': 'post', '请求头部信息': '', '请求地址': '/cgi-bin/tags/create', '请求参数(get)': '{"access_token":"63_wg5W7gleQfRjqxLsu6GWfPerPsOZwrPw7GmNkh0cl88to61ts9rh3WUFve-muB4Mh8ywmkYgG_4Q9MdKoLAd0GW5Z98xnvwFGLOIbIiRRjjY-IRg9-2W3BxS0VMEXVhADAHAY"}', '请求参数(post)': '{"tag":{"name":"邵阳12"}}', '取值方式': '正则取值', '取值变量': 'tag_id', '取值代码': '"id":(.+?),', '断言类型': 'json_key', '期望结果': ''}, {'测试用例编号': 'api_case_3', '测试用例名称': '删除标签接口测试', '用例执行': '是', '用例步骤': 'step_03', '接口名称': '删除标签接口', '请求方式': 'post', '请求头部信息': '', '请求地址': '/cgi-bin/tags/delete', '请求参数(get)': '{"access_token":"${token}"}', '请求参数(post)': '{"tag":{"id":${tag_id}}}', '取值方式': '无', '取值变量': '', '取值代码': '', '断言类型': 'json_key_value', '期望结果': '{"errcode":0}'}]})) (paramunittest.TestApiCase_2)</li></ol></p>
<p class='attribute'><strong>错误用例合集 : </strong> <ol style='float: left;'>无</ol></p>

    <p class='description'>数据驱动+关键字驱动框架</p>
</div>
<div id="container"></div>
</div>



<div style="width: 500px; clear: both;">
<p id='show_detail_line'>
<a class="btn btn-primary" href='javascript:showCase(0)'>概要{ 33.33% }</a>
<a class="btn btn-success" href='javascript:showCase(2)'>通过{ 1 }</a>
<a class="btn btn-danger" href='javascript:showCase(1)'>失败{ 2 }</a>
<a class="btn btn-warning" href='javascript:showCase(3)'>错误{ 0 }</a>
<a class="btn btn-info" href='javascript:showCase(4)'>所有{ 3 }</a>
</p>
</div>
<table id='result_table' class="table table-condensed table-bordered table-hover">
<colgroup>
<col align='left' style="width: 300px;"/>
<col align='right' style="width: 300px;"/>
<col align='right' />
<col align='right' />
<col align='right' />
<col align='right' />
<col align='right' />
<col align='right' style="width: 200px;"/>
</colgroup>
<tr id='header_row' class="text-center success" style="font-weight: bold;font-size: 14px;">
    <td>用例集/测试用例</td>
    <td>说明</td>
    <td>总计</td>
    <td>通过</td>
    <td>失败</td>
    <td>错误</td>
    <td>耗时</td>
    <td>详细</td>
</tr>

<tr class='passClass warning'>
    <td>TestApiCase_0</td>
    <td></td>
    <td class="text-center">1</td>
    <td class="text-center">1</td>
    <td class="text-center">0</td>
    <td class="text-center">0</td>
    <td class="text-center">0.39秒</td>
    <td class="text-center"><a href="javascript:showClassDetail('c1',1)" class="detail" id='c1'>详细</a></td>
</tr>

<tr id='pt1_1' class='hiddenRow'>
    <td class='passCase' style="vertical-align: middle"><div class='testcase'>test_api_case</div></td>
    <td style="vertical-align: left"></td>
    <td colspan='5' align='center'><span class="label label-success success">通过</span></td>
    <td class='passCase' style="vertical-align: middle"></td>
</tr>

<tr class='failClass warning'>
    <td>TestApiCase_1</td>
    <td></td>
    <td class="text-center">1</td>
    <td class="text-center">0</td>
    <td class="text-center">1</td>
    <td class="text-center">0</td>
    <td class="text-center">0.46秒</td>
    <td class="text-center"><a href="javascript:showClassDetail('c2',1)" class="detail" id='c2'>详细</a></td>
</tr>

    <tr id='ft2_1' class='none'>
        <td class='failCase' style="vertical-align: middle"><div class='testcase'>test_api_case</div></td>
        <td style="vertical-align: middle"></td>
        <td colspan='5' align='center'>
        <!--默认收起错误信息 -Findyou
        <button id='btn_ft2_1' type="button"  class="btn btn-xs collapsed" data-toggle="collapse" data-target='#div_ft2_1'>失败</button>
        <div id='div_ft2_1' class="collapse">  -->

        <!-- 默认展开错误信息 -Findyou /  修复失败按钮的颜色 -- Gelomen -->
        <button id='btn_ft2_1' type="button"  class="btn btn-xs" data-toggle="collapse" data-target='#div_ft2_1'>失败</button>
        <div id='div_ft2_1' class="collapse in">
        <pre style="text-align:left">
        
ft2_1: {"access_token":"63_wg5W7gleQfRjqxLsu6GWfPerPsOZwrPw7GmNkh0cl88to61ts9rh3WUFve-muB4Mh8ywmkYgG_4Q9MdKoLAd0GW5Z98xnvwFGLOIbIiRRjjY-IRg9-2W3BxS0VMLRLhADACIC"}

{"errcode":45056,"errmsg":"too many tag now, no need to add new hint: [Rfnf1u5Vf-nkgENa] rid: 6382db58-2fca40db-55fa7c0e"}
Traceback (most recent call last):
  File "/Users/liuqingjun/PycharmProjects/API_TEST_FRAME_P17_P18/testcases/test_api_case.py", line 26, in test_api_case
    self.assertTrue( actual_result['check_result'],actual_result['message'] )
AssertionError: False is not true : 进行响应正文为json数据时的键比对，期望结果：%s，与实际结果不符合，断言失败


        </pre>
        </div>
        </td>
        <td class='failCase' style="vertical-align: middle"></td>
    </tr>
    
<tr class='failClass warning'>
    <td>TestApiCase_2</td>
    <td></td>
    <td class="text-center">1</td>
    <td class="text-center">0</td>
    <td class="text-center">1</td>
    <td class="text-center">0</td>
    <td class="text-center">0.44秒</td>
    <td class="text-center"><a href="javascript:showClassDetail('c3',1)" class="detail" id='c3'>详细</a></td>
</tr>

    <tr id='ft3_1' class='none'>
        <td class='failCase' style="vertical-align: middle"><div class='testcase'>test_api_case</div></td>
        <td style="vertical-align: middle"></td>
        <td colspan='5' align='center'>
        <!--默认收起错误信息 -Findyou
        <button id='btn_ft3_1' type="button"  class="btn btn-xs collapsed" data-toggle="collapse" data-target='#div_ft3_1'>失败</button>
        <div id='div_ft3_1' class="collapse">  -->

        <!-- 默认展开错误信息 -Findyou /  修复失败按钮的颜色 -- Gelomen -->
        <button id='btn_ft3_1' type="button"  class="btn btn-xs" data-toggle="collapse" data-target='#div_ft3_1'>失败</button>
        <div id='div_ft3_1' class="collapse in">
        <pre style="text-align:left">
        
ft3_1: {"access_token":"63_wg5W7gleQfRjqxLsu6GWfPerPsOZwrPw7GmNkh0cl88to61ts9rh3WUFve-muB4Mh8ywmkYgG_4Q9MdKoLAd0GW5Z98xnvwFGLOIbIiRRjjY-IRg9-2W3BxS0VMEXVhADAHAY"}
"id":(.+?),
{"errcode":45056,"errmsg":"too many tag now, no need to add new hint: [RfnfLoEVf-MbMjxa] rid: 6382db58-0027e5aa-594cdc15"}
Traceback (most recent call last):
  File "/Users/liuqingjun/PycharmProjects/API_TEST_FRAME_P17_P18/testcases/test_api_case.py", line 26, in test_api_case
    self.assertTrue( actual_result['check_result'],actual_result['message'] )
AssertionError: False is not true : 调用[创建标签接口]时发生系统异常，异常原因：list index out of range


        </pre>
        </div>
        </td>
        <td class='failCase' style="vertical-align: middle"></td>
    </tr>
    
<tr id='total_row' class="text-center active">
    <td colspan='2'>总计</td>
    <td>3</td>
    <td>1</td>
    <td>2</td>
    <td>0</td>
    <td>1.29秒</td>
    <td>通过率：33.33%</td>
</tr>
</table>

<div id='ending'>&nbsp;</div>
    <div id="toTop" style=" position:fixed;right:50px; bottom:30px; width:20px; height:20px;cursor:pointer; display: none">
    <a><span class="glyphicon glyphicon-eject" style = "font-size:30px;" aria-hidden="true">
    </span></a></div>
    

</body>
</html>
